package com.xbongbong.saas.model;

import com.xbongbong.paas.pojo.dto.SaasFormSaveDTO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.saas.domain.entity.ProductUserEntity;
import com.xbongbong.saas.domain.entity.UserAndDepTeamEntity;

import java.util.List;
import java.util.Map;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/2/24 16:24
 * @since v1.0
 */
public interface ProductUserModel extends IModel<ProductUserEntity> {
    @Override
    Integer insert(ProductUserEntity entity) throws XbbException;

    @Override
    Integer update(ProductUserEntity entity) throws XbbException;

    @Override
    List<ProductUserEntity> findEntitys(Map<String, Object> param);

    @Override
    Integer getEntitysCount(Map<String, Object> param);

    /**
     * 批量插入
     * @param insetBatchList
     */
    void inserBatch(List<ProductUserEntity> insetBatchList) throws XbbException;

    /**
     * 批量更新
     * @param insetBatchList
     */
    void updateBatch(List<ProductUserEntity> insetBatchList,String corpid) throws XbbException;
    /**
     * 批量删除
     * @param corpid 公司id
     * @param delIdList idList
     */
    void deleteBatch(String corpid, List<Long> delIdList) throws XbbException;

    /**
     * 批量删除
     * @param corpid 公司id
     * @param delIdList idList
     */
    void batchDel(String corpid, List<Long> delIdList, List<ProductUserEntity> userEntities) throws XbbException;

    /**
     * @param productId 产品id
     * @param corpid    公司id
     * @description: 建立产品全公司关系
     * @author: GuoJun.HU
     * @date: 2017/11/13 19:14
     * @modify:
     * @version:
     */
    void refreshProductUser(SaasFormSaveDTO saasFormSaveDTO, Long productId, String corpid, List<Object> visbleDept, List<Object> visbleUser) throws XbbException;

    /**
     * 获取产品团队基本信息
     * @param map
     * @return
     */
    List<UserAndDepTeamEntity> findBaseEntitys(Map<String,Object> map);


    ProductUserEntity getByKey(Long teamUserId, String corpid);

    void delete(ProductUserEntity productUserEntity) throws XbbException;

    Integer deleteByParentIdInAndRelationIdInByScript(List<Long> parentIdIn, List<Object> relationIdIn, Integer type,List<Long> deleteList) throws XbbException;


    Integer deleteByParentIdInAndRelationIdIn(String corpid, List<Long> parentIdIn, List<Object> relationIdIn, Integer type,List<Long> deleteList) throws XbbException;

    Integer deleteByProductIdInAndRelationIdIn(String corpid, List<Long> productIdIn, List<Object> relationIdIn, Integer type) throws XbbException;
}
